<template>
  <div class="top-warap">

    <div class="left-content">
      <div class="left-avstar">
        <img :src="avatar" class="avatarimage">
      </div>
      <div class="left-body">
        <div class="name">{{companyName}}</div>
        <div class="company">{{nickName}}</div>
      </div>
    </div>
    <div class="right-content">
      <!--      <img :src="icon" class="image">-->
    </div>
  </div>
</template>

<script>
  import store from '@/store/store'
  import {isEmpty} from 'lodash'

  export default {
    name: 'Top',
    computed: {
      authCode () {
        // 用户授权码
        return store.state.authCode
      },
      companyName () {
        // 用户授权码
        return store.state.companyName
      },
      avatar () {
        return store.state.userInfo.avatar
      },
      nickName () {
        if (isEmpty(store.state.userInfo.nickName)) {
          return '未获取到'
        }
        return store.state.userInfo.nickName
      }
    },
    data () {
      return {
        icon: require(`@/common/image/right-icon.png`)
      }
    }
  }
</script>

<style scoped lang="scss">
  @import "../common/common";

  .top-warap {
    display: flex;
    justify-content: space-between;
    background: $contentTopBackgroundColor;
    padding: 15px 2px;
    color: #fff;


    .left-content {
      display: flex;
      align-items: center;

      .name {
        font-size: 20px;
      }

      .left-avstar {
        margin-right: 20px;
      }

      .left-body {
        .company {
          font-size: 14px;
          opacity: .7;
        }
      }

    }

    .right-content {
      display: flex;
      width: .5rem;
      justify-content: flex-end;
      align-items: center;

      .image {
        width: 8px;
        height: 14px;
      }
    }
  }

  .avatarimage {
    width: 30px;
    height: 30px;
    border-radius: 100%;
  }
</style>
